/**
 * @(#) INXTCommand.java
 */

package pcsr.drivers.nxtDriver.command;

public interface INXTCommand
{

	/*
	 * BT Address still needs to be cleaned up to display unsigned bytes.
	 */
	DeviceInfo GetDeviceInfo( );

	/**
	 * @param port - Output port (0 - 2 or 0xFF for all three)
	 * @param power - Setpoint for power. (-100 to 100)
	 * @param mode - Setting the modes MOTORON, BRAKE, and/or REGULATED. This parameter is a bitfield, so to put it in brake mode and regulated, use BRAKEMODE + REGULATED
	 * @param regulationMode - see NXTProtocol for enumerations
	 * @param turnRatio - Need two motors? (-100 to 100)
	 * @param runState - see NXTProtocol for enumerations
	 * @param tachoLimit - Number of degrees(?) to rotate before stopping.
	 */
	byte SetOutputState( int port, byte power, int mode, int regulationMode, int turnRatio, int runState, int tachoLimit );

	/**
	 * Tells the NXT what type of sensor you are using and the mode to operate in.
	 * @param port - 0 to 3
	 * @param sensorType - Enumeration for sensor type (see NXTProtocol)
	 * @param sensorMode - Enumeration for sensor mode (see NXTProtocol)
	 */
	byte SetInputMode( int port, int sensorType, int sensorMode );

	/**
	 * Retrieves the current output state for a port.
	 * @param port - 0 to 3
	 * @return OutputState - returns a container object for output state variables.
	 */
	OutputState GetOutputState( int port );

	InputValues GetInputValues( int port );

	/**
	 * Resets either RotationCount or BlockTacho
	 * @param port Output port (0-2)
	 * @param relative TRUE: BlockTacho, FALSE: RotationCount
	 */
	byte ResetMotorPosition( int port, boolean relative );

	/**
	 * Plays a tone on NXT speaker. If a new tone is sent while the previous tone is playing,
	 * the new tone command will stop the old tone command.
	 * @param frequency - 100 to 2000?
	 * @param duration - In milliseconds.
	 * @return - Returns true if command worked, false if it failed.
	 */
	byte PlayTone( int frequency, int duration );

	int GetBatteryLevel( );

	/**
	 * Returns the status for an Inter-Integrated Circuit (I2C) sensor (the
	 * ultrasound sensor) via the Low Speed (LS) data port. The port must first
	 * be configured to type LOWSPEED or LOWSPEED_9V.
	 * @param port 0-3
	 * @return byte[0] = status, byte[1] = Bytes Ready (count of available bytes to read)
	 */
	byte[] LSGetStatus( byte port );

	/**
	 * Used to request data from an Inter-Integrated Circuit (I2C) sensor (the
	 * ultrasound sensor) via the Low Speed (LS) data port. The port must first
	 * be configured to type  LOWSPEED or LOWSPEED_9V.
	 * Data lengths are limited to 16 bytes per command.
	 * Rx (receive) Data Length MUST be specified in the write
	 * command since reading from the device is done on a
	 * master-slave basis.
	 * @param txData Transmitted data.
	 * @param rxDataLength Receive data length.
	 * @param port 0-3
	 * @return The lower part of the value 
	 */
	byte LSWrite( byte port, byte[] txData, byte rxDataLength );

	/**
	 * Reads data from an Inter-Integrated Circuit (I2C) sensor (the
	 * ultrasound sensor) via the Low Speed (LS) data port. The port must
	 * first be configured to type LOWSPEED or LOWSPEED_9V.
	 * Data lengths are limited to 16 bytes per command. The response will
	 * also contain 16 bytes, with invalid data padded with zeros.
	 * @param port
	 * @return The lower part of the value 
	 */
	byte[] LSRead( byte port );

	boolean IsVerify( );

	void Open( );

	void Close( );

	void SetVerify( boolean verify );

}
